package cn.zonhar.controller;

import cn.zonhar.common.core.R;
import cn.zonhar.service.CityService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/city")
public class CityController {

    @Autowired
    private CityService cityService;

    @GetMapping("/getCityByUnit")
    public R getCityByUnit(Integer unitId){
        JSONArray cityByUnit = cityService.getCityByUnit(unitId);
        return R.ok().put("data",cityByUnit);
    }

}
